feat(cloud_server): implement SSL secure websocket from semver2 into semver3 - #723
feat(cloud_server): implement SSL secure websocket from semver2 into semver3#723Boss-1s wants to merge 24 commits into
Conversation
…semver3 Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
- Moved `BaseCloudServer` (Formerly `_SaCloudServer`) to sa.eventhandlers._base Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
|
Tell me if you require help in applying these changes |
(cherry picked from commit 8d30697) Signed-off-by: GitHub <noreply@github.com>
9a6846e to
2950297
Compare
### sa.eventhandlers._base - changed list comp to generator comp in set_project_vars() and set_var() - reimplemented attribute type hints into BaseCloudServer. since type hints are inhierted, there is no need to restate them in child classes of BaseCloudServer. ### sa.eventhandlers.cloud_server - added type hitns to __init__ of BaseCloudServer child classes - added type hints to init_cloud_server and init_ssl_cloud_server - revert changing warnings.warn to print in 9863d50 Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Co-authored-by: TheCommCraft <79996518+TheCommCraft@users.noreply.github.com> Signed-off-by: Boss_1s <95505913+Boss-1s@users.noreply.github.com>
| ) | ||
| ) | ||
|
|
||
| def set_var(self, project_id, var_name, value, *, user="@server", skip_forward=None): |
There was a problem hiding this comment.
Maybe we should change the server to store the variables with their actual names and then add the option to skip adding the cloud prefix
There was a problem hiding this comment.
Further examination is required to determine whether the current implementation works. I might have time to do this later but at the moment I am busy.
|
I'm just going to try and apply these changes myself |
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: GitHub <noreply@github.com>
Signed-off-by: Boss_1s <95505913+Boss-1s@users.noreply.github.com>
| *, | ||
| user: str = "@server", | ||
| skip_forward=None, | ||
| skip_broadcast_for: WebSocket | None = None, |
There was a problem hiding this comment.
Should we add documentation or something of the sort for this argument?
Signed-off-by: Boss_1s <95505913+Boss-1s@users.noreply.github.com>
| skip_broadcast_for=self, | ||
| no_prefix=True, | ||
| ) | ||
| send_to_clients: CloudActivityDict = { |
There was a problem hiding this comment.
CloudActivityDict typed dict doesn't accept some of the values listed below
There was a problem hiding this comment.
the dict must be a CloudActivityDict and the extra entries will only be ignored so we should just remove the extra entries
|
serveforever is implemented with a while loop of serveonce |
Resolves nothing
Changes
Implemented SSL secure ws server (fix cloud server #658) from semver2 into semver 3
New class
_SaWebSockectServerBaseWebSocketServerinsa.eventhandlers._baseto keep things pythonic and organizedrefactoring everything related cause why not
Tasks
Tests
First, start up an insecure server to ensure it works:
While the above script is running, run
websocat ws://127.0.0.1:8080to interact with the websocket.Once you have determined that this works, replace the above script with the one below:
Then, generate an OpenSSL certificate:
Finally, run the server script, and interact with the WebSocket with
websocat -k wss://127.0.0.1:8080Notes
might wanna have #722 fixed before merging this, idk